/*
 * RecursoForm.java
 *
 * Created on 4 de diciembre de 2005, 21:56
 */
package org.fiel.admin.struts.forms;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.upload.FormFile;

/**
 * @author Ing. Luis Pablo Gallo
 */
public class RecursoForm extends ActionForm{
    private String id = null;
    private String nombre = null;
    private String apellido = null;
    private String cargoId = null;
    private String areaId = null;
    private String cv = null;
    private FormFile cvFile = null;

    /** Creates a new instance of AreaForm */
    public RecursoForm() {
    }

    public void reset   ( ActionMapping mapping
                        , HttpServletRequest request ){
        this.id = null;
        this.nombre = null;
        this.setApellido(null);
        this.setCargoId(null);
        this.setAreaId(null);
        this.setCv(null);
    }

    public ActionErrors validate( ActionMapping mapping
                                , HttpServletRequest request ){
        ActionErrors errors = new ActionErrors();
        
        if(this.id==null || this.id.length()<1){
            errors.add("id", new ActionError("error.id.requerido"));
        }
        if(this.nombre==null || this.nombre.length()<1){
            errors.add("nombre", new ActionError("error.nombre.requerido"));
        }
        if(this.getApellido()==null || this.getApellido().length()<1){
            errors.add("nombre", new ActionError("error.apellido.requerido"));
        }
        
        return errors;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getApellido() {
        return apellido;
    }

    public void setApellido(String apellido) {
        this.apellido = apellido;
    }

    public String getCargoId() {
        return cargoId;
    }

    public void setCargoId(String cargoId) {
        this.cargoId = cargoId;
    }

    public String getAreaId() {
        return areaId;
    }

    public void setAreaId(String areaId) {
        this.areaId = areaId;
    }

    public String getCv() {
        return cv;
    }

    public void setCv(String cv) {
        this.cv = cv;
    }

    public FormFile getCvFile() {
        return cvFile;
    }

    public void setCvFile(FormFile cvFile) {
        this.cvFile = cvFile;
    }

}
